package com.yinhe.music.yhmusic.personal.vip;

import com.yinhe.music.yhmusic.base.IBaseModel;
import com.yinhe.music.yhmusic.network.response.ResponseTransformer;
import com.yinhe.music.yhmusic.personal.PersonPresenter;

public class ProductPresenter extends PersonPresenter<IBaseModel, ProductListContract.IProductListView> implements ProductListContract.IProductListPresenter {

    @Override
    public void getProductList(String productType) {
        if (getView() == null) {
            return;
        }

        addSubscription(mModel.getProductsList(productType)
                .compose(ResponseTransformer.handleResult())
                .compose(schedulerProvider.applySchedulers())
                .subscribe(vipListInfo -> {
                    getView().setProductListUI(vipListInfo);
                }, throwable -> {
                    getView().showMessage(throwable);
                }));
    }
}
